package com.itheima.Array.DoublePointer;

/**
 * @Author: Ethan Yankang
 * @Program: code-random-recordings
 * @Date: 2024-07-28 18:23
 **/
public class RemoveDuplications {
    public int removeDuplications(int[] nums  ) {
        int length=nums.length;
        int slowIndex=0;
        int fastIndex=1;
        while (fastIndex<length){
            if (nums[slowIndex]!=nums[fastIndex]){
                nums[++slowIndex]=nums[fastIndex];
            }
            fastIndex++;
        }
        return slowIndex+1;
    }
}
